package com.junjiao.util.web;

import java.io.InputStream;
import java.util.Properties;

/**
 * @author wanggz
 * 
 */
final class HttpClientParams {

	public static int maxThreadsTotal;
	public static int maxThreadsPerHost;
	public static int connectionTimeout;
	public static int soTimeout;

	public static boolean useProxy;
	public static String proxyHost;
	public static int proxyPort;

	public static String ntlmUsername;
	public static String ntlmPassword;
	public static String ntlmHost;
	public static String ntlmDomain;

	public static int sendBufferSize;
	public static int receiveBufferSize;

	static {

		Properties pro = null;
		try {

			pro = new Properties();
			InputStream ins = HttpClientParams.class.getClassLoader()
					.getResourceAsStream("httpClient.properties");
			pro.load(ins);

			maxThreadsTotal = Integer.parseInt(pro
					.getProperty("maxThreadsTotal"));
			maxThreadsPerHost = Integer.parseInt(pro
					.getProperty("maxThreadsPerHost"));
			connectionTimeout = Integer.parseInt(pro
					.getProperty("connectionTimeout"));

			useProxy = Boolean.parseBoolean(pro.getProperty("useProxy"));
			proxyHost = pro.getProperty("proxyHost");
			proxyPort = Integer.parseInt(pro.getProperty("proxyPort"));

			ntlmUsername = pro.getProperty("ntlmUsername");
			ntlmPassword = pro.getProperty("ntlmPassword");
			ntlmHost = pro.getProperty("ntlmHost");
			ntlmDomain = pro.getProperty("ntlmDomain");

			sendBufferSize = Integer
					.parseInt(pro.getProperty("sendBufferSize"));
			receiveBufferSize = Integer.parseInt(pro
					.getProperty("receiveBufferSize"));

			ins.close();
			ins = null;

		} catch (Exception e) {
			e.printStackTrace();

		} finally {
			pro = null;
		}
	}

	public static void main(String args[]) {
		System.out.println(HttpClientParams.ntlmDomain);
	}
}
